<?php
//include file
include("../include/session.php");
require_once('../db_conn/conn_db.php');

$act = $_REQUEST['action'];
$order = $_POST['order_id'];
$content = $_POST['content'];
$status = $_REQUEST['status'];
$id = $_REQUEST['id'];

switch($act) {
	case "save" : $sql = "insert into surat_perjanjian values('','$order','$content','1',now())";
				  $msg = "Simpan";
	break;
	case "update" : $sql = "update surat_perjanjian set content='$content' where id=$id"; $msg = "Update";
	break;
	case "delete" : $sql = "delete from surat_perjanjian where id=$id"; $msg = "Delete";
	break;
}

	$result = mysql_query($sql) 
		or die("Gagal Query. Error :".mysql_error());


	echo 
					"<script language=\"JavaScript\">
					alert(\"Data Sukses di $msg \" ,\"Pesan\");
					location.href = \"view_perjanjian.php\"
					</script>";
	 

?>